package com.ruoyi.project.system.borrow.controller;

import com.ruoyi.common.utils.security.ShiroUtils;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.BaseEntity;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.system.approval.service.IApprovalService;
import com.ruoyi.project.system.borrow.domain.Borrow;
import com.ruoyi.project.system.borrow.service.IBorrowService;
import com.ruoyi.project.system.item.service.IItemService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/system/promise")
public class PromiseController extends BaseController {

    private String prefix = "system/promise";

    @Autowired
    private IBorrowService borrowService;

    @Autowired
    private IItemService itemService;
    @Autowired
    private IApprovalService approvalService;

    @RequiresPermissions("system:promise:view")
    @GetMapping()
    public String promise() {
        return prefix + "/promise";
    }

    /**
     * 查询物品申请列表
     */
    @RequiresPermissions("system:promise:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(Borrow borrow) {
        startPage();
        List<Borrow> list = borrowService.selectBorrowPromiseList(borrow);
        return getDataTable(list);
    }

}

